﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace BloodGlucoseManagerApplication
{
    /// <summary>
    /// Interaction logic for CreateNewPatientWindow.xaml
    /// </summary>
    public partial class CreateNewPatientWindow : Window
    {
        Controller ctr;
        public CreateNewPatientWindow(Controller controller)
        {
            this.ctr = controller;
            InitializeComponent();
            morningDatePicker.Format = System.Windows.Forms.DateTimePickerFormat.Time;
            midtDayDatePicker.Format = System.Windows.Forms.DateTimePickerFormat.Time;
            dinnerDatePicker.Format = System.Windows.Forms.DateTimePickerFormat.Time;
            nightDatePicker.Format = System.Windows.Forms.DateTimePickerFormat.Time;


            morningDatePicker.Value = new DateTime(2000, 1, 1, 7, 0, 0);
            midtDayDatePicker.Value = new DateTime(2000, 1, 1, 12, 0, 0);
            dinnerDatePicker.Value = new DateTime(2000, 1, 1, 18, 0, 0);
            nightDatePicker.Value = new DateTime(2000, 1, 1, 22, 0, 0);
        }

        private void buttonSave_Click(object sender, RoutedEventArgs e)
        {
            ctr.CreateNewPatient(
                textBoxName.Text,
                textBoxSSN.Text,
                morningDatePicker.Value,
                midtDayDatePicker.Value,
                dinnerDatePicker.Value,
                nightDatePicker.Value,
                int.Parse(textBoxLow.Text),
                int.Parse(textBoxHigh.Text));
            this.DialogResult = true;
            
        }

        private void buttonCancel_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
        }
    }
}
